package utils.independent;

import java.io.File;

import swissmap.Constants;

public class RMAP_rename_forBatchConv {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String[] res={"200k","100k","50k","25k","20k","10k"};  //,"20k","10k"};
		//for(String curres:res)
		String curres="20k";
		{
			for(int r=0;r<99;r++){
				for(int c=0;c<99;c++){
					String fname_old=Constants.basePath+curres+File.separator+""+curres+"_map_"+((c<10)?"0"+c:c)+"_"+((r<10)?"0"+r:r);
					System.out.println(fname_old);
					File jpg =new File(fname_old+".jpg");
					//File rmap =new File(Constants.basePath+curres+File.separator+curres+"_map_"+((c<10)?"0"+c:c)+"_"+((r<10)?"0"+r:r)+".RMAP");

					String fname_new=null;
					if(jpg.exists()){
						fname_new=Constants.basePath+curres+File.separator+""+curres+"-"+((c<10)?"0"+c:c)+"-"+((r<10)?"0"+r:r);
						File rtmap=new File(fname_new+".jpg");
						
						boolean success = jpg.renameTo(rtmap);
						if (!success) { 
							System.out.println("Rename failed jpg "+jpg.getAbsolutePath());  
						}
						//System.out.println(rmap.getAbsolutePath());
					}

//					File imp =new File(fname_old+".imp");
//					if(imp.exists()){
//						File rtmap=new File(fname_new+".imp");
//						
//						boolean success = imp.renameTo(rtmap);
//						if (!success) { 
//							System.out.println("Rename failed imp "+imp.getAbsolutePath());  
//						}
//						//System.out.println(rmap.getAbsolutePath());
//					}
					
				}
			}
		}
		
		// TODO Auto-generated method stub
		// File (or directory) with old name 
		File file = new File("oldname"); // File (or directory) with new name 
		File file2 = new File("newname"); // Rename file (or directory) 
		boolean success = file.renameTo(file2); 
		if (!success) { 
			// File was not successfully renamed  
		}

	}

}
